package nl.pcnerd.roelve.javagame.map;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.imageio.ImageIO;

import nl.pcnerd.roelve.javagame.Game;

public class Map {

	private ArrayList<Tile> tileMap;
	private ArrayList<Tile> fringeMap;
	// temp
	private BufferedImage def;

	public Map() {
		tileMap = new ArrayList<Tile>();
		// TODO delete this temp thing
		def = null;
		try {
			def = ImageIO.read(new File("spriteSheet.png"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		makeDefault();
	}

	private void makeDefault() {
		for (int i = 0; i < Game.HTILES; i++) {
			for (int y = 0; y < Game.VTILES; y++) {
				tileMap.add(new Tile(0, i, y, def, true));
			}
		}
	}

	/**
	 * Returns all the tiles on this map, that are to be displayed as the ground
	 * layer. This will always be displayed below the player
	 * 
	 * @return The ground floor tile map
	 */
	public ArrayList<Tile> getTileMap() {
		return tileMap;
	}

	public ArrayList<Tile> getFringeMap() {
		return fringeMap;
	}

	public void setFringeMap(ArrayList<Tile> fringeMap) {
		this.fringeMap = fringeMap;
	}

}
